package com.example.qqfragment;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;

public class HomeActivity extends AppCompatActivity {
    private Context context;
    private EditText userNameEditText,passwordEditText;
    private Button loginButton;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        context=this;
        initview();
    }
    private void initview(){
        userNameEditText=findViewById(R.id.qqname);
        passwordEditText=findViewById(R.id.passwordEditText);
        loginButton=findViewById(R.id.login);
        loginButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //登录页面
                String username=userNameEditText.getText().toString();
                String password=passwordEditText.getText().toString();

                if(username.length()>0){
                    if(username.equals("zhangjia")){
                        if(password.length()>0){
                            if(password.equals("123456")){
                                Intent intent=new Intent(HomeActivity.this,MainActivity.class);
                                startActivity(intent);
                            }
                        }
                    }
                }
            }
            private void showMsg(String msg){
                Toast.makeText(context,msg, Toast.LENGTH_SHORT).show();
            }
        });

    }
}